<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="utf-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%><%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<tiles:insertDefinition name="dialog-layout">
	<tiles:putAttribute name="head">
		<script type="text/javascript">
	    $(function() {
		$(".confirm").confirmDialog(function(data) {
		    helper.showMsg(data, {
			okHandler : function() {
			    location.reload();
			}
		    });
		});

		$(".remark").change(function() {

		    var form = $(this).closest("form");

		    var url = "../orderlesson/doRemarkLog";
		    $.post(url, form.serialize());
		});

		$(".ajax").anchorAjax(function() {
		    location.reload();
		});
	    });
	</script>
	</tiles:putAttribute>
	<tiles:putAttribute name="mainBody">
		<table class="table">
			<caption>
				<strong> <s:if test="#log.lesson == null">
历史订课详情
					</s:if> <s:elseif test="#log.signCourse == null">
试听订课详情
					</s:elseif> <s:else>
					订课详情
					</s:else>
				</strong>
			</caption>
			<tr>
				<th>状态</th>
				<td><s:if test="#log.mark.toString() == 'Good'">
						<i class="icon-thumbs-up" title="Good"></i>
					</s:if> <s:elseif test="#log.mark.toString()== 'Bad'">
						<i class="icon-thumbs-down" title="Bad"></i>
					</s:elseif> <s:if test="#log.leaveEarly">
						<i class="icon-download" title="早退"></i>早退
		</s:if> <s:if test="#log.beLate">
						<i class="icon-time" title="迟到"></i>迟到
		</s:if> <s:if test="!#log.valid">
						<span class="label">不统计课时</span>
					</s:if></td>
			</tr>
			<tr>
				<th>姓名</th>
				<td><s:url id="viewLogByTime" action="viewLogByTime" namespace="/log">
						<s:param name="id" value="#log.student.id"></s:param>
					</s:url> <a href="${viewLogByTime}" target="_parent"> ${log.student.name}(${log.student.stuId}) </a></td>
			</tr>
			<tr>
				<th>订课时间</th>
				<td><s:date name="#log.beginTime" format="yyyy-MM-dd" /> ${log.timespan}</td>
			</tr>
			<tr>
				<th>课程名称</th>
				<td><s:url action="listListener" namespace="/lesson" id="listListener">
						<s:param name="id" value="#log.lesson.id"></s:param>
					</s:url> <a href="${listListener}" target="_parent">${log.lesson.name}</a> <s:if test="canceled">
						<span class="label">已取消</span>
					</s:if></td>
			</tr>
			<tr>
				<th>教员</th>
				<td><s:iterator value="#log.lesson.teachings" var="teaching" status="status">
								${teaching.teacher.name}
								<s:if test="!status.last">,</s:if>
					</s:iterator></td>
			</tr>
			<tr>
				<th>教室</th>
				<td>${log.lesson.classroom.name}</td>
			</tr>
			<tr>
				<th>详情</th>
				<td><form style="display: inline;" action="doRemarkLog">
						<input type="hidden" name="id" value="${log.id}" />
						<textarea name="remark" class="remark">${log.teacherRemark}</textarea>
					</form>
					<div>
						<s:url action="doMarkGoodOrderLesson" namespace="/orderlesson" id="doMarkGoodOrderLesson">
							<s:param name="id" value="#log.id"></s:param>
						</s:url>
						<a href="${doMarkGoodOrderLesson}" class="ajax">
							<i class="icon-thumbs-up"></i>
						</a>
						<s:url action="doMarkBadOrderLesson" namespace="/orderlesson" id="doMarkBadOrderLesson">
							<s:param name="id" value="#log.id"></s:param>
						</s:url>
						<a href="${doMarkBadOrderLesson}" class="ajax">
							<i class="icon-thumbs-down"></i>
						</a>
						<s:url action="doLateOrderLesson" namespace="/orderlesson" id="doLateOrderLesson">
							<s:param name="id" value="#log.id"></s:param>
						</s:url>
						<s:url action="doEarlyOrderLesson" namespace="/orderlesson" id="doEarlyOrderLesson">
							<s:param name="id" value="#log.id"></s:param>
						</s:url>
						<s:url action="doResetOrderLesson" namespace="/orderlesson" id="doResetOrderLesson">
							<s:param name="id" value="#log.id"></s:param>
						</s:url>
						<div class="btn-group">
							<a class="btn dropdown-toggle" data-toggle="dropdown" href="#">
								上课情况标注 <span class="caret"></span>
							</a>
							<ul class="dropdown-menu">
								<s:if test="!beLate">
									<li><a title="设置该学员为迟到" class="confirm" href="${doLateOrderLesson}">迟到</a></li>
								</s:if>
								<s:if test="!leaveEarly">
									<li><a title="设置该学员为早退" class="confirm" href="${doEarlyOrderLesson}">早退</a></li>
								</s:if>
								<li><a title="重置该次订课状态" class="confirm" href="${doResetOrderLesson}">重置</a></li>
							</ul>
						</div>
						<s:if test="#log.valid">
							<s:url action="doUnValidOrderLesson" namespace="/orderlesson" id="doUnValidOrderLesson">
								<s:param name="id" value="#log.id"></s:param>
							</s:url>
							<a title="不统计课时" type="button" class="btn confirm" href="${doUnValidOrderLesson}">
								<i class="icon-minus"></i>不统计课时
							</a>
						</s:if>
						<s:else>
							<s:url action="doValidOrderLesson" namespace="/orderlesson" id="doValidOrderLesson">
								<s:param name="id" value="#log.id"></s:param>
							</s:url>
							<a title="计算课时" type="button" class="btn confirm" href="${doValidOrderLesson}">
								<i class="icon-plus"></i>统计课时
							</a>
						</s:else>
						<s:url action="doCancelOrderLesson" namespace="/orderlesson" id="doCancelOrderLesson">
							<s:param name="id" value="#log.id"></s:param>
						</s:url>
						<a title="撤销该次订课" type="button" class="btn confirm" href="${doCancelOrderLesson}">撤销</a>
					</div></td>
			</tr>
		</table>
	</tiles:putAttribute>
</tiles:insertDefinition>